package javaer.starter.util;

import org.apache.commons.codec.binary.Base64;

import java.nio.charset.StandardCharsets;

/**
 * base64加解密
 *
 * @author yangzhen
 * @date 2023/6/7 15:45
 * @since 1.0.0
 */
public class Base64Util {

    public static String encode(String content) {
        byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
        return new String(Base64.encodeBase64(bytes), StandardCharsets.UTF_8);
    }

    public static String decode(String content) {
        byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
        return new String(Base64.decodeBase64(bytes), StandardCharsets.UTF_8);
    }
}
